/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

/**
 *
 * @author Reinhard
 */
public class LoginModel {
  Connection connection;

  public LoginModel(Connection connection) {
    this.connection = connection;
  }

  public ResultSet doLogin(String username, String password) throws SQLException {
    String query = "SELECT * from user WHERE username = '" + username + "' AND password = md5('" + password + "')";
    Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
    ResultSet rs = statement.executeQuery(query);
    return rs;
  }
  
  
  
}
